package edu.winona.csclub.testing.gui;

import java.util.HashMap;
import java.util.List;

import javax.swing.JScrollPane;
import javax.swing.JTable;

import edu.winona.csclub.testing.core.Result;
import edu.winona.csclub.testing.core.Test;
import edu.winona.csclub.testing.core.TestCase;

public class TestsView extends JScrollPane {

	public HashMap<Test,Result> result = new HashMap<Test,Result>();
	
	private TestCase testcase;
	private JTable table=new JTable(new TestsTableModel(this));;
	
	public TestsView(TestCase tc){
		super();
		testcase =tc;
		setViewportView(table); 
		
	}

	public List<Test> getTests() {
		if(testcase==null)return null;
		return testcase.getTests();
	}

	public void update(TestCase case1) {
		testcase= case1;
		table.updateUI();
	}

	public Test getSelectedTest() {
		return testcase.getTests().get(table.getSelectedRow());		
	}

	/**
	 * @return the table
	 */
	public JTable getTable() {
		return table;
	}
}
